package at.fhooe.mcm.app;

import java.awt.EventQueue;

import at.fhooe.mcm.logic.core.Core;
import at.fhooe.mcm.logic.logging.LoggingService;
import at.fhooe.mcm.logic.network.server.Server;
import at.fhooe.mcm.view.ManagementView;

public class EMSServer
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				try
				{

					// initialize the application's core
					Core core = Core.createServerCore(LoggingService.DEBUG, Server.SERVER_PORT);
					
					
					// initialize the server and start it
					Server server = new Server(core);
					server.start();
					
					// initialize the view and show it
					ManagementView view = new ManagementView(core);
					core.redirectConsoleLoggingOutput(view.getRedirectedSystemStreams());
					core.start();
					view.show();
				}		
				catch (Exception e)
				{
					e.printStackTrace();
				}

			}
		});

	}

}
